home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- * WinDosIO WinMain Module - By compiling this module and linking with your
- * DOS application in C or C++, most DOS applications can be run under
- * Microsoft Windows with no changes at all(The header file WinDosIO.h
- * should be included to eliminate warnings and even potential errors
- * if not compiling with the large model!)
- * For WinDOSIO Version 2.0 BETA
- * Copyright Graubart-Cervone Software 1991,1992
- *****************************************************************************/
- #include <windows.h>
- #include <string.h>
-
- #include <WinDosIO.h>
-
-
- #define MAXARGS 16
-
- #define MAX_CMDLINE 128
-
- int pascal WinMain(HANDLE hInstance, HANDLE hPrevInstance,
- LPSTR lpszCmdline, int cmdshow)
-
- {
- struct CWS cws;
- struct CWS far *cwsP;
- char cmdLineBuffer[MAX_CMDLINE];
- HWND hwnd;
- MSG msg;
- RECT r;
- char *argv[MAXARGS];
- int argc;
- short i;
-
- /* Adapt to any memory model */
- for (i = 0; i < MAX_CMDLINE; i++)
- if (!(cmdLineBuffer[i] = *lpszCmdline++)) break;
- /* Initialize terminal IO */
- WinDosIO(WD_INIT,hInstance,0);
- WinDosIO(WD_REGISTER_WINDOW,hPrevInstance,0);
- hwnd = WinDosIO(WD_CREATE_MAIN_WINDOW,cmdshow,
- (long)((LPSTR)"WinDosIO"));
-
- GetClientRect(hwnd,&r);
-
-
- cws.cwsTop = r.top;
- cws.cwsLeft = r.left;
- cws.cwsXSize = r.right - r.left;
- cws.cwsYSize = r.bottom - r.top;
- cws.cwsTitle = "";
- cws.cwsFlags = 0;
- cwsP = &cws;
- WinDosIO(WD_CREATE_CHILD_WINDOW,0,(unsigned long)cwsP);
- argv[0] = "WinDosIO";
- if (argv[argc=1] = strtok(cmdLineBuffer," "))
- for (argc = 2; argc < MAXARGS; argc++)
- if (!(argv[argc] = strtok(NULL," "))) break;
-
- main(argc,argv);
-
-
-
- /* Use WinDosIO(WD_DESTROY,hwnd, 0); to terminate application
- without having to click on system close icon.
- */
-
- while( GetMessage( &msg, 0, 0, 0 ) != 0 )
- {
- TranslateMessage( &msg );
- DispatchMessage( &msg );
- }
-
- return 0;
- }
-
-
-